#include "../log_system/log_system.h"
#include "extension.hpp"
#include <unistd.h>



int main()
{
// loggerManager.hpp
    std::unique_ptr<log_system::LoggerBuilder> builder(new log_system::GlobalLoggerBuilder());
    std::string name("async_logger");
    builder->buildLoggerName(name);
    builder->buildLoggerLevel(log_system::LogLevel::value::DEBUG);
    builder->buildFormatter("[%d{%H:%M:%S}][%c][%f:%l][%p]%m%n");
    builder->buildLoggerType(log_system::LoggerType::LOGGER_ASYNC);
    builder->buildSink<extensionLS::RollingByTimeSink>("./log/rollingLog-", extensionLS::TimeInterval::SECOND_INTERVAL);
    log_system::Logger::ptr logger = builder->build();


    time_t start = log_system::util::Date::now();

    while(log_system::util::Date::now() < start + 5)
    {
        logger->fatalLog("这是一条测试日志");
    }

   
    return 0;
}